(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof this!=="undefined"){t=this}else if(typeof self!=="undefined"){t=self}else if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}t.videojsPlaylist=e()}})(function(){var e,t,i;return function e(t,i,n){function a(r,o){if(!i[r]){if(!t[r]){var d=typeof require=="function"&&require;if(!o&&d)return d(r,!0);if(l)return l(r,!0);var s=new Error("Cannot find module '"+r+"'");throw s.code="MODULE_NOT_FOUND",s}var f=i[r]={exports:{}};t[r][0].call(f.exports,function(e){var i=t[r][1][e];return a(i?i:e)},f,f.exports,e,t,i,n)}return i[r].exports}var l=typeof require=="function"&&require;for(var r=0;r<n.length;r++)a(n[r]);return a}({1:[function(e,t,i){(function(e){"use strict";Object.defineProperty(i,"__esModule",{value:true});function n(e){return e&&e.__esModule?e:{default:e}}var a=typeof window!=="undefined"?window["videojs"]:typeof e!=="undefined"?e["videojs"]:null;var l=n(a);var r={thumbnailSize:190,playlistItems:3,hideIcons:false,upNext:true,hideSidebar:false,mobile:false};var o=undefined;var d=false;var s=[];var f=[];var u=[];var p=[];var v=null;var c=function e(t,i,n,a){var l=document.createElement("li");var o=document.createElement("div");o.className="vjs-playlist-video-title";o.setAttribute("data-index",i);if(i==0){if(r.upNext){var d=document.createElement("div");d.className="vjs-playlist-video-upnext";d.innerText="UP Next";o.appendChild(d)}}if(n){var s=document.createElement("div");s.innerText=n;s.setAttribute("data-index",i);o.appendChild(s);l.appendChild(o)}if(a)l.setAttribute("style","background-image: url('"+a+"');");l.setAttribute("data-index",i);l.onclick=function(e){var i=parseInt(e.target.getAttribute("data-index"));j(t,i,true)};return l};var m=function e(t,i){f[t.id_]=i.videos;s[t.id_]=0;d=i.playlist.mobile;if(i.playlist&&i.playlist.thumbnailSize){r.thumbnailSize=i.playlist.thumbnailSize.toString().replace("px","")}if(i.playlist&&i.playlist.items){r.playlistItems=i.playlist.items}if(i.playlist&&i.playlist.hideIcons){r.hideIcons=i.playlist.hideIcons}if(i.playlist&&i.playlist.hideSidebar){r.hideSidebar=i.playlist.hideSidebar}y(t,i);x(t)};var y=function e(t,i){v=document.createElement("ul");v.className="vjs-playlist-items";if(!r.hideSidebar){t.el().appendChild(v)}p[t.id_]=v;if(f[t.id_].length>0){f[t.id_].map(function(e,i){p[t.id_].appendChild(c(t.id_,i,e.title,e.thumbnail))});j(t.id_,0,false)}if(!r.hideIcons){var n=document.createElement("button");n.className="vjs-button-prev";n.onclick=g;t.controlBar.el().insertBefore(n,t.controlBar.playToggle.el());var a=document.createElement("button");a.className="vjs-button-next";a.onclick=b;t.controlBar.el().insertBefore(a,t.controlBar.volumeMenuButton.el())}t.on("ended",h);t.addClass("vjs-playlist")};var h=function e(){w()};var b=function e(t){var i=t.target.parentNode.parentNode.id;w(i)};var g=function e(t){var i=t.target.parentNode.parentNode.id;_(i)};var x=function e(t){var i=function e(t){var i=r.thumbnailSize;var n=t.el().id;var a=t.el().offsetWidth;var l=t.el().offsetHeight;var o=Math.floor((l-10)/r.playlistItems)-10;var d=t.$(".vjs-tech");var s=a-i;if(s>=0){var f=n+"_styles";var u=document.getElementById(f);if(!u)u=document.createElement("style");var p=" #"+n+".vjs-playlist .vjs-poster { width: "+s+"px !important; }"+" #"+n+".vjs-playlist .vjs-playlist-items { width: "+i+"px !important; }"+" #"+n+".vjs-playlist .vjs-playlist-items li { height: "+o+"px !important; }"+" #"+n+".vjs-playlist .vjs-modal-dialog { width: "+s+"px !important; } "+" #"+n+".vjs-playlist .vjs-control-bar, #"+n+".vjs-playlist .vjs-tech { width: "+s+"px !important; } "+" #"+n+".vjs-playlist .vjs-big-play-button, #"+n+".vjs-playlist .vjs-loading-spinner { left: "+Math.round(s/2)+"px !important; } "+" #"+n+" .vimeoFrame { width: "+s+"px !important; } "+" #"+n+" .vimeoFrame.vimeoHidden { padding-bottom: 0 !important; } ";u.setAttribute("id",f);u.setAttribute("type","text/css");document.getElementsByTagName("head")[0].appendChild(u);if(u.firstChild){u.firstChild.textContent=p}else{u.appendChild(document.createTextNode(p))}}};if(!r.hideSidebar){t.on("fullscreenchange",function(){i(this)});window.addEventListener("resize",function(e){i(t)});if(t){i(t)}}};var j=function e(t,i,n){if(!t){t=o.id_}s[t]=i;var a=u[t].el().querySelectorAll("ul.vjs-playlist-items li");for(var l=0;l<a.length;l++){if(l==i){a[l].classList.add("current")}else{a[l].classList.remove("current")}}try{if(!u[t].paused()){u[t].pause();u[t].error(null)}}catch(e){}var r={type:f[t][i].type,src:f[t][i].src};var p=t+"_wmv_player";if(r.type=="video/x-ms-wmv"){var v=document.getElementById(p);if(!v){v=document.createElement("div");v.setAttribute("id",p);v.setAttribute("class","vjs-tech");u[t].el().appendChild(v)}var c=u[t].wmvConfig;c.file=r.src;if(!!f[t][i].thumbnail)c.image=f[t][i].thumbnail;var m=new window.jeroenwijering.Player(v,"/bitrix/components/bitrix/player/wmvplayer/wmvplayer.xaml",u[t].wmvConfig)}else{var v=document.getElementById(p);if(!!v)v.parentNode.removeChild(v);var y=u[t].el().getElementsByClassName("vimeoFrame");for(var l=0;l<y.length;l++){y[l].classList.add("vimeoHidden")}if(r.type=="video/vimeo"){var h="vimeo_wrapper_"+t;if(!!document.getElementById(h))document.getElementById(h).classList.remove("vimeoHidden")}u[t].src(r);u[t].poster(f[t][i].thumbnail);if(!d&&(n||u[t].options_.autoplay)){try{u[t].play()}catch(e){}}}};var w=function e(t){if(!t){t=o.id_}if(s[t]<f[t].length-1){s[t]++}else{s[t]=0}j(t,s[t],true)};var _=function e(t){if(!t){t=o.id_}if(s[t]>0){s[t]--}else{s[t]=f[t].length-1}j(t,s[t],true)};var E=function e(t){var i=this;this.ready(function(){o=i;u[o.id_]=o;m(i,l["default"].mergeOptions(t,r))})};l["default"].plugin("playlist",E);i["default"]=E;t.exports=i["default"]}).call(this,typeof this!=="undefined"?this:typeof self!=="undefined"?self:typeof global!=="undefined"?global:typeof window!=="undefined"?window:{})},{}]},{},[1])(1)});